package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.AgencyInfo;
import cn.wolfcode.crm.mapper.AgencyInfoMapper;
import cn.wolfcode.crm.query.AgencyInfoQueryObject;
import cn.wolfcode.crm.service.IAgencyInfoService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AgencyInfoServiceImpl implements IAgencyInfoService {

    @Autowired
   private AgencyInfoMapper agencyInfoMapper;
    public void deleteByPrimaryKey(Long id) {
        agencyInfoMapper.deleteByPrimaryKey(id);
    }

    public void insert(AgencyInfo record) {
        agencyInfoMapper.insert(record);
    }

    public AgencyInfo selectByPrimaryKey(Long id) {
        return agencyInfoMapper.selectByPrimaryKey(id);
    }

    public List<AgencyInfo> selectAll() {
        return agencyInfoMapper.selectAll();
    }

    public void updateByPrimaryKey(AgencyInfo record) {
        agencyInfoMapper.updateByPrimaryKey(record);
    }

    public PageResult query(AgencyInfoQueryObject qo) {
        int total = agencyInfoMapper.queryFormCount(qo);
        if(total == 0){
            return new PageResult();
        }
        List<AgencyInfo> list = agencyInfoMapper.queryFormList(qo);
        return new PageResult(total,list);
    }

    public void changeSate(Long id) {
        agencyInfoMapper.changeSate(id);
    }

    public List<String> selectAgencyName() {
        return agencyInfoMapper.selectAgencyName();
    }

    public List<AgencyInfo> queryAll() {
        return agencyInfoMapper.queryAll();
    }
}
